<template>
  <div>
    <div class="banner" @click="handleBannerClick">
      <img class="banner_img" :src="bannerImg">
      <div class="banner_info">
        <div class="info_desc">{{sightName}}</div>
        <div class="img_number">
          <span class="iconfont">&#xe607;</span>
          {{this.galleryImgs.length}}
        </div>
      </div>
    </div>
    <common-fade>
      <common-gallery
        :imgs="galleryImgs"
        v-show="showGallery"
        @change="handleGalleryChange"></common-gallery>
    </common-fade>
  </div>
</template>

<script>
import commonGallery from 'common/gallery/Gallery'
import commonFade from 'common/fade/Fade'
export default {
  name: 'detailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    galleryImgs: Array
  },
  components: {
    commonGallery,
    commonFade
  },
  data () {
    return {
      showGallery: false
    }
  },
  methods: {
    handleBannerClick () {
      this.showGallery = true
    },
    handleGalleryChange () {
      this.showGallery = false
    }
  }
}
</script>
<style lang="stylus" scoped>
  .banner
    position relative
    overflow hidden
    height 0
    padding-bottom 55%
    .banner_img
      width 100%
    .banner_info
      padding-right .2rem
      display flex
      position absolute
      left 0
      right 0
      bottom 0
      line-height .6rem
      color #fff
      background linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, .8))
      .info_desc
        flex 1
        font-size .32rem
        padding 0 .2rem
      .img_number
        background rgba(0,0,0,.8)
        border-radius .2rem
        height .32rem
        line-height .32rem
        padding 0 .4rem
        font-size .24rem
        margin-top .14rem
        span
          font-size .24rem
</style>
